package yto.freemarker.springaop.test;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import yto.freemarker.springaop.app.AppConfig;
import yto.freemarker.springaop.dao.IndexMapper;

/**
 * @author dongxing
 **/
public class Mytest {
    public static void main(String[] args) {

        //初始化Spring的环境
        AnnotationConfigApplicationContext annotationConfigApplicationContext
                = new AnnotationConfigApplicationContext();
        annotationConfigApplicationContext.register(AppConfig.class);
        annotationConfigApplicationContext.refresh();
        //获取Bean
//        UserMapper userMapper = annotationConfigApplicationContext.getBean(UserMapper.class);
//        IndexMapper indexMapper = annotationConfigApplicationContext.getBean(IndexMapper.class);
        IndexMapper indexMapper = (IndexMapper) annotationConfigApplicationContext.getBean("indexMapper");
        System.out.println(indexMapper.findUsers());

//        UserMapper userMapper = annotationConfigApplicationContext.getBean(UserMapper.class);
//        System.out.println(userMapper.getUsers());

    }
}
